@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#root {
  height: 100%;
  width: 100%;
}

/* 基础动画 */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 基础样式类 */
.glass-effect {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gradient-bg {
  background: linear-gradient(to bottom, #f5f3ff, #e0f2fe);
}

.button-hover {
  transition: transform 0.2s ease;
}

.button-hover:hover {
  transform: scale(1.02);
}

.button-hover:active {
  transform: scale(0.98);
}

/* 移动端适配 */
@media (max-width: 640px) {
  .container {
    padding: 0 0.5rem;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .gradient-bg {
    background: linear-gradient(to bottom, #1a1a1a, #2d2d2d);
  }

  .glass-effect {
    background: rgba(0, 0, 0, 0.8);
  }
}

@layer base {
  :root {
    --foreground-rgb: 0, 0, 0;
    --background-rgb: 255, 255, 255;
  }

  body {
    color: rgb(var(--foreground-rgb));
    background: rgb(var(--background-rgb));
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
}

@layer components {
  .glass-effect {
    @apply bg-white/80 backdrop-blur-xl border border-gray-200/50;
  }

  .button-glow {
    @apply relative overflow-hidden;
  }

  .button-glow::before {
    content: '';
    @apply absolute inset-0 bg-gradient-to-r from-purple-500/90 via-pink-500/90 to-blue-500/90 rounded-full blur-xl transition-all duration-300;
  }

  .button-glow:hover::before {
    @apply blur-2xl;
  }

  .template-card {
    @apply relative transition-all duration-300 transform hover:scale-105;
  }

  .template-card::before {
    content: '';
    @apply absolute inset-0 bg-gradient-to-b from-purple-500/30 to-purple-500/50 opacity-0 transition-opacity duration-300;
  }

  .template-card:hover::before {
    @apply opacity-100;
  }
}

@layer utilities {
  .animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
  }

  .animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  }

  .animate-ping-slow {
    animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

@keyframes ping {
  75%, 100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
  width: 12rpx;
  height: 12rpx;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6rpx;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 6rpx;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* 毛玻璃效果 */
.backdrop-blur-sm {
  backdrop-filter: blur(16rpx);
  -webkit-backdrop-filter: blur(16rpx);
}

/* 发光效果 */
.border-glow {
  box-shadow: 0 0 20rpx rgba(255, 255, 255, 0.3);
}

/* 渐变文字效果 */
.gradient-text {
  background: linear-gradient(to right, #fff, #e2e8f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Swiper 容器样式 */
.swiper-container {
  perspective: 4000rpx;
  transform-style: preserve-3d;
}

/* Swiper 导航按钮样式 */
.swiper-button-next,
.swiper-button-prev {
  color: white !important;
  background: rgba(255, 255, 255, 0.15) !important;
  width: 96rpx !important;
  height: 96rpx !important;
  border-radius: 50% !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  backdrop-filter: blur(16rpx) !important;
  border: 2rpx solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.1) !important;
  margin: 0 16rpx !important;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  transform: scale(1.1) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.15) !important;
}

.swiper-button-next:after,
.swiper-button-prev:after {
  font-size: 40rpx !important;
  font-weight: bold !important;
  text-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.2) !important;
}

.swiper-button-disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  transform: scale(0.9) !important;
}

/* 移动端适配 */
@media screen and (max-width: 750rpx) {
  .swiper-button-next,
  .swiper-button-prev {
    width: 80rpx !important;
    height: 80rpx !important;
    margin: 0 8rpx !important;
  }

  .swiper-button-next:after,
  .swiper-button-prev:after {
    font-size: 32rpx !important;
  }
}

/* Swiper 分页器样式 */
.swiper-pagination-bullet {
  background: white !important;
  opacity: 0.5 !important;
  transition: all 0.3s ease;
  width: 16rpx !important;
  height: 16rpx !important;
}

.swiper-pagination-bullet-active {
  opacity: 1 !important;
  transform: scale(1.2);
}

/* 模板卡片样式 */
.template-card {
  position: relative;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.template-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0));
  border-radius: 32rpx;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.template-card:hover::before {
  opacity: 1;
}

/* 模板切换动画 */
.swiper-slide {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
}

.swiper-slide-active {
  transform: scale(1.1) translateZ(40rpx);
  z-index: 2;
}

.swiper-slide-prev,
.swiper-slide-next {
  transform: scale(0.9) translateZ(0);
  opacity: 0.7;
}

.swiper-slide-prev {
  transform: scale(0.9) translateX(10%) translateZ(0) rotateY(10deg);
}

.swiper-slide-next {
  transform: scale(0.9) translateX(-10%) translateZ(0) rotateY(-10deg);
}

/* 拍照按钮动画 */
@keyframes buttonPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* 相机错误模态框样式 */
.camera-error-modal .ant-modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20rpx);
  border-radius: 40rpx;
  padding: 40rpx;
}

.camera-error-modal .ant-modal-header {
  background: transparent;
  border-bottom: none;
  padding: 0 0 32rpx 0;
}

.camera-error-modal .ant-modal-body {
  padding: 32rpx 0;
}

/* 发光边框动画 */
@keyframes borderGlow {
  0%, 100% {
    box-shadow: 0 0 10rpx rgba(255, 255, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 40rpx rgba(255, 255, 255, 0.6);
  }
}

.border-glow {
  animation: borderGlow 2s infinite;
}

.border-glow:hover {
  animation: borderGlow 1s infinite;
} 